home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / games_d / oasys.zip / EXAMPLE.S < prev    next >
Text File  |  1991-02-04  |  1KB  |  73 lines

  1. /*    Example OASYS code by Russell Wallace 31 Jan 1991
  2.     This code is in the public domain
  3. */
  4.  
  5. class player {}
  6. class room {}
  7.  
  8. property object in
  9. property object n
  10. property object s
  11. property string desc
  12.  
  13. object room1
  14. object room2
  15.  
  16. method look verbs {{look}}
  17. {
  18.     print this in desc
  19.     print "\n"
  20. }
  21.  
  22. method save verbs {{save}}
  23. {
  24.     save
  25. }
  26.  
  27. method load verbs {{load} {restore}}
  28. {
  29.     if load
  30.         this look
  31. }
  32.  
  33. method quit verbs {{quit}}
  34. {
  35.     quit
  36. }
  37.  
  38. method go_north verbs {{n} {north} {go north}}
  39. {
  40.     if not this in n exists
  41.     {
  42.         print "You can't go that way.\n"
  43.         return
  44.     }
  45.     this in = this in n
  46.     this look
  47. }
  48.  
  49. method go_south verbs {{s} {south} {go south}}
  50. {
  51.     if not this in s exists
  52.     {
  53.         print "You can't go that way.\n"
  54.         return
  55.     }
  56.     this in = this in s
  57.     this look
  58. }
  59.  
  60. method init
  61. {
  62.     print "Game starting ...\n"
  63.     player = create player
  64.     room1 = create room
  65.     room2 = create room
  66.     room1 n = room2
  67.     room2 s = room1
  68.     room1 desc = "Room 1"
  69.     room2 desc = "Room 2"
  70.     player in = room1
  71.     player look
  72. }
  73.